<?php /*a:3:{s:54:"D:\phpstudy_pro\WWW\night\app\view\specitem\index.html";i:1601301313;s:53:"D:\phpstudy_pro\WWW\night\app\view\public\header.html";i:1601967767;s:53:"D:\phpstudy_pro\WWW\night\app\view\public\footer.html";i:1601179064;}*/ ?>
<header>
    <title>规格值列表</title>
</header>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <link rel="stylesheet" href="/static/layui/css/layui.css">
    <script src="/static/layui/layui.js"></script>
    <script src="/static/jquery.min.js"></script>
</head>
<body class="layui-layout-body">

<div class="layui-layout layui-layout-admin">

    <div class="layui-header">
        <div class="layui-logo">商品后台管理系统</div>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item"><a href="/index/welcome">首页</a></li>
            <li class="layui-nav-item"><a href="/node/add">节点添加</a></li>
            <li class="layui-nav-item">
                <a href="javascript:;">其它系统</a>
                <dl class="layui-nav-child">
                    <dd><a href="">邮件管理</a></dd>
                    <dd><a href="">消息管理</a></dd>
                    <dd><a href="">授权管理</a></dd>
                </dl>
            </li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img src="http://t.cn/RCzsdCq" class="layui-nav-img">
                    <?php echo htmlentities($user['admin_name']); ?>
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="">基本资料</a></dd>
                    <dd><a href="">安全设置</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item"><a href="/admin/LoginOut">退了</a></li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree"  lay-filter="test">
                <?php foreach($node_list as $key=>$vo): ?>
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:;"><?php echo htmlentities($vo['node_name']); ?></a>
                    <dl class="layui-nav-child">

                        <?php foreach($vo['node'] as $k=>$v): ?>
                        <dd><a href="<?php echo htmlentities($v['node_url']); ?>"><?php echo htmlentities($v['node_name']); ?></a></dd>
                        <?php endforeach; ?>
                    </dl>
                </li>
                <?php endforeach; ?>
<!--                <li class="layui-nav-item">-->
<!--                    <a href="javascript:;">解决方案</a>-->
<!--                    <dl class="layui-nav-child">-->
<!--                        <dd><a href="javascript:;">列表一</a></dd>-->
<!--                        <dd><a href="javascript:;">列表二</a></dd>-->
<!--                        <dd><a href="">超链接</a></dd>-->
<!--                    </dl>-->
<!--                </li>-->
<!--                <li class="layui-nav-item"><a href="">云市场</a></li>-->
<!--                <li class="layui-nav-item"><a href="">发布商品</a></li>-->
            </ul>
        </div>
    </div>

    <div class="layui-body">

<table class="layui-hide" id="test" lay-filter="test"></table>

<script type="text/html" id="toolbarDemo">
    <fieldset class="layui-elem-field">
        <legend>当前规格名称</legend>
        <div class="layui-field-box">
            <b style="font-size: 32px;color: #FD482C"><?php echo htmlentities($list['spec_name']); ?></b>
        </div>
    </fieldset>
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm" lay-event="add">添加规格值</button>
    </div>
</script>

<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>


<script>
    layui.use('table', function(){
        var table = layui.table;

        table.render({
            elem: '#test'
            ,url:'/specitem/data?id=<?php echo htmlentities($list['id']); ?>'
            ,toolbar: '#toolbarDemo' //开启头部工具栏，并为其绑定左侧模板
            ,defaultToolbar: ['filter', 'exports', 'print', { //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
                title: '提示'
                ,layEvent: 'LAYTABLE_TIPS'
                ,icon: 'layui-icon-tips'
            }]
            ,title: '用户数据表'
            ,cols: [[
                {field:'id', title:'ID', width:80, fixed: 'left', unresize: true, sort: true}
                ,{field:'spec_value', title:'规格值', width:120}
                ,{field:'status', title:'状态', width:120}

                ,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:150}
            ]]
            ,page: true
        });

        //头工具栏事件
        table.on('toolbar(test)', function(obj){
            var checkStatus = table.checkStatus(obj.config.id);
            switch(obj.event){
                case 'add':
                   //location.href="specitem/add/spec_id/<?php echo htmlentities($list['id']); ?>";
                    location.href="/Specitem/add/spec_id/<?php echo htmlentities($list['id']); ?>"
                    break;
                //自定义头工具栏右侧图标 - 提示
            };
        });

        //监听行工具事件
        table.on('tool(test)', function(obj){
            var data = obj.data;
            //console.log(obj)
            if(obj.event === 'del'){
                layer.confirm('真的删除行么', function(index){
                    $.post(
                        "/specitem/del",
                        {
                            id:data.id
                        },
                        function (data) {
                            //alert(data.msg);
                            layui.use('layer', function(){
                                layer.alert('删除成功', {
                                    skin: 'layui-layer-molv'
                                    ,closeBtn: 0
                                    ,anim: 1 //动画类型
                                });
                            });
                            if(data.code == 0){
                                obj.del();
                            }
                        }
                    );
                    layer.close(index);
                });
            } else if(obj.event === 'edit'){
                location.href="/specitem/update/id/"+data.id;
            }
        });
    });
</script>

</div>
</div>

<!--<div class="layui-footer">-->
<!--    &lt;!&ndash; 底部固定区域 &ndash;&gt;-->
<!--    © layui.com - 底部固定区域-->
<!--</div>-->
</div>
<script>
    //JavaScript代码区域
    layui.use('element', function(){
        var element = layui.element;

    });
</script>
</body>
</html>